<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    
    <title>展商管理</title>
    
	<link rel="stylesheet" type="text/css" href="<%=path%>/JS/extjs/resources/css/ext-all.css"/>
	<link rel="stylesheet" type="text/css" href="<%=path%>/JS/extjs/ux/gridfilters/css/GridFilters.css" />
    <link rel="stylesheet" type="text/css" href="<%=path%>/JS/extjs/ux/gridfilters/css/RangeMenu.css" />
    
	<script type="text/javascript" src="<%=path%>/JS/extjs/adapter/ext-base.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ext-all.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ext-lang-zh_CN.js"></script>
	
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/menu/RangeMenu.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/menu/ListMenu.js"></script>
	
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/GridFilters.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/filter/Filter.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/filter/StringFilter.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/filter/DateFilter.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/filter/ListFilter.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/filter/NumericFilter.js"></script>
	<script type="text/javascript" src="<%=path%>/JS/extjs/ux/gridfilters/filter/BooleanFilter.js"></script>
	
	
	
	<script type="text/javascript" src="<%=path%>/JS/jquery-1.7.2.js"></script>
	
	<script type="text/javascript">
	var showId = "";//展会ID
	var grid = null;//列表
	
	function openUpdateDialog(){
		Ext.useShims=true;

	    var win=new Ext.Window(
	    	    {title:"新增",
	        	    width:500,
	        	    height:490,
	        	    //html:updateDialogStr,
	        	    modal:true,
	        	    closeAction:"close",
	        	    buttons:[{
	        	    	text:"确认",handler:function(){
	        	    	
	        	    }}, {
		        	    text:"取消",handler:function(){
	        	    	win.close();
	        	    	}
			       	}]
	        	}); 
	    win.show();
		//点击右上角的关闭按钮后
	    win.on("close",function(){
		});
	}

	//等待提示
	function loadMask(msg){
		var loadMask = new Ext.LoadMask(Ext.getBody(),{msg:msg});
		return loadMask;
	}
	
	function deleteCompany(selID,store){
		var loadMask = new Ext.LoadMask(Ext.getBody(),{msg:"正在删除，请稍候..."});
		//var loadMask = loadMask();
		Ext.MessageBox.confirm("提示","确定删除？",function(btn){
			if(btn=="yes"){
				if(selID == ""){
					Ext.Msg.alert("提示","请选择删除行");
				}else if(selID != ""){
					loadMask.show();
					Ext.Ajax.timeout = 3 * 60 * 1000;
	        		Ext.Ajax.request({
	        		       url: '${pageContext.request.contextPath}/companyManagerAction!deleteCompany.action',
	        		       method : 'POST',
	        		       params:{SelIDStr:selID},
	        			   success: function(response, options){
		        		   		var resultjson = Ext.util.JSON.decode(response.responseText);
	        			  	 	//alert("*********" + response.responseText);
	        			  	 	refresh(store);
	        			  	 	loadMask.hide();
	            			   	Ext.Msg.alert("提示","操作成功");
	        		       },
	        			   failure : function(request){   
	        		           Ext.MessageBox.show({   
	        		                   title : '提示',   
	        		                    msg : "操作失败",   
	        		                    buttons : Ext.MessageBox.OK,   
	        		                    icon : Ext.MessageBox.ERROR   
	        		                    });   
	        		       }
	        		  });
				}
			}else if(btn=="no" || btn=="cancel"){
				//return false;
			}
		});
	}

	
	function refresh(store){
		store.reload();
		//重新选择行
	    grid.getSelectionModel().clearSelections();
	    showId = "";//展会ID
	}
	
	
	</script>

  </head>
  
  <body>
    <script type="text/javascript">
    //var audienceArr = Array();
    //当前选中行的id值
    var selID = "";
    var store = null;
	var type;
    
  		$(function(){
  			//当ajax写在此处时，会先加载页面，然后才会有json数据，所以，要在json数据返回以后，再回载页面
  		});
  		function InitMain(){
  			var url = document.location.href;
			var arrStr = url.substring(url.indexOf("?")+1).split("&");
			type=arrStr[0].replace("type=","");
			var encode = false;
			var local = true;//当前页查询，false为远程查询
		    
			//复选框
			var sm = new Ext.grid.CheckboxSelectionModel({checkOnly:false});
			//列过滤
			var filters = new Ext.ux.grid.GridFilters({
		        encode: encode,
		        local: local,
		        filters: [{
		            type: 'numeric',
		            dataIndex: 'id'
		        }, {
		            type: 'string',
		            dataIndex: 'CompName'
		           // disabled: true
		        }, {
		            type: 'string',
		            dataIndex: 'EasyName'
		        }, {
		            type: 'string',
		            dataIndex: 'EasyNameEn'
		        }, {
		            type: 'string',
		            dataIndex: 'CompUrl'
		        }, {
		            type: 'string',
		            dataIndex: 'AssetType'
		        }, {
		            type: 'string',
		            dataIndex: 'ManageType'
		        }, {
		            type: 'string',
		            dataIndex: 'MustCredentials'
		        }, {
		            type: 'date',
		            dataIndex: 'RegisterDate'
		        }]
		    });
  			var cm = new Ext.grid.ColumnModel([
										  sm,
   	  	                 	  	          {
   	  	              	  	                  id       : 'id',
   	  	              	  	                  header   : 'ID', 
   	  	              	  	                  width    : 25, 
   	  	              	  	                  sortable : true, //排序
			   	  	              	  	      filter   : {
			   	  	            	              type : 'numeric'
			   	  	            	          },
   	  	              	  	                  dataIndex: 'id'
   	  	              	  	              },{
   	  	              	  	                  header   : '企业名称', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                  dataIndex: 'CompName'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '简称', 
   	  	              	  	                  width    : 45, 
   	  	              	  	                  sortable : true, 
   	  	              	  	                  renderer : showSex,
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                  dataIndex: 'EasyName'
   	  	              	  	              },{
   	  	              	  	                  header   : '英文名称', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
			   	  	            	     	  hidden   : true,
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'CompNameEn'
   	  	              	  	              },{
   	  	              	  	                  header   : '英文简称', 
   	  	              	  	                  width    : 45, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  hidden   : true,
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'string'
			   	  	            	          },
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'EasyNameEn'
   	  	              	  	              },{
   	  	              	  	                  header   : '企业地址', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true,
   	  	              	  	         		  hidden   : true,
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'CompAddr'
   	  	              	  	              },{
   	  	              	  	                  header   : '英文地址', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  hidden   : true,
   	  	              	  	                  // renderer : 'usMoney',
   	  	              	  	                  dataIndex: 'CompAddrEn'
   	  	              	  	              },{
   	  	              	  	                  header   : '总经理', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  hidden   : true,
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'Manager'
   	  	              	  	              },{
   	  	              	  	                  header   : '总经理手机', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  			  		  hidden   : true,
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'ManagerTel'
   	  	              	  	              },{
   	  	              	  	                  header   : '法人代表', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  			  		  hidden   : true,
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'Fman'
   	  	              	  	              },{
   	  	              	  	                  header   : '法人代表手机', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  			  		  hidden   : true,
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'FmanTel'
   	  	              	  	              }/*,{
   	  	              	  	                  header   : '负责人', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true,
   	  	              	  			  		  hidden   : true, 
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'ChargeMen'
   	  	              	  	              },{
   	  	              	  	                  header   : '负责人手机', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'ChargeMenTel'
   	  	              	  	              },{
   	  	              	  	                  header   : '负责人职务', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true,
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'ChargeMenJob'
   	  	              	  	              }*/,{
   	  	              	  	                  header   : '企业电话', 
   	  	              	  	                  width    : 60, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  hidden   : true,
   	  	              	  	                  dataIndex: 'CompTel'
   	  	              	  	              },{
   	  	              	  	                  header   : '企业传真', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  hidden   : true,
   	  	              	  	                  dataIndex: 'CompFax'
   	  	              	  	              }/*,{
   	  	              	  	                  header   : '邮政编码', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  			  		  hidden   : true,
   	  	              	  	                 // renderer : 'usMoney', 
   	  	              	  	                  dataIndex: 'CompPostCode'
   	  	              	  	              }*/,{
   	  	              	  	                  header   : '企业邮箱', 
   	  	              	  	                  width    : 85, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  hidden   : true,
   	  	              	  	                  dataIndex: 'CompEmail'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '企业网址', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'String'
			   	  	            	          },
   	  	              	  	                  dataIndex: 'CompUrl'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '企业资产类型', 
   	  	              	  	                  width    : 35, 
   	  	              	  	                  sortable : true,
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'String'
			   	  	            	          }, 
   	  	              	  	                  //renderer : isVailabel, 
   	  	              	  			   		  hidden   : true,
   	  	              	  	                  dataIndex: 'AssetType'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '企业经营类型', 
   	  	              	  	                  width    : 35, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'String'
			   	  	            	          },
   	  	              	  	                  //renderer : isVailabel, 
   	  	              	  			   		  hidden   : true,
   	  	              	  	                  dataIndex: 'ManageType'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '参展条件', 
   	  	              	  	                  width    : 35, 
   	  	              	  	                  sortable : true, 
   	  	              	  	                  //renderer : isVailabel,
   	  	              	  	                  filter   : {
			   	  	            	              type : 'String'
			   	  	            	          }, 
   	  	              	  			   		  hidden   : true,
   	  	              	  	                  dataIndex: 'MustCredentials'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '参展品牌', 
   	  	              	  	                  width    : 35, 
   	  	              	  	                  sortable : true, 
   	  	              	  	                  //renderer : isVailabel, 
   	  	              	  			   		  hidden   : true,
   	  	              	  	                  dataIndex: 'CompBrands'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '企业荣誉', 
   	  	              	  	                  width    : 35, 
   	  	              	  	                  sortable : true, 
   	  	              	  	                  //renderer : isVailabel, 
   	  	              	  			   		  hidden   : true,
   	  	              	  	                  dataIndex: 'CompApprove'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '主要产品', 
   	  	              	  	                  width    : 35, 
   	  	              	  	                  sortable : true, 
   	  	              	  	                  //renderer : isVailabel, 
   	  	              	  			   		  hidden   : true,
   	  	              	  	                  dataIndex: 'CompProduct'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '备注', 
   	  	              	  	                  width    : 35, 
   	  	              	  	                  sortable : true, 
   	  	              	  	                  //renderer : isVailabel, 
   	  	              	  			   		  hidden   : true,
   	  	              	  	                  dataIndex: 'Remark'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '负责人', 
   	  	              	  	                  width    : 35, 
   	  	              	  	                  sortable : true, 
   	  	              	  	                 // renderer : isVailabel, 
   	  	              	  			   		  //hidden   : true,
   	  	              	  	                  dataIndex: 'PostName'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '负责人电话', 
   	  	              	  	                  width    : 45, 
   	  	              	  	                  sortable : true, 
   	  	              	  	                 // renderer : isVailabel, 
   	  	              	  			   		  //hidden   : true,
   	  	              	  	                  dataIndex: 'PostTel'
   	  	              	  	              },
   	  	              	  	              {
   	  	              	  	                  header   : '邮政编码', 
   	  	              	  	                  width    : 35, 
   	  	              	  	                  sortable : true, 
   	  	              	  	                 // renderer : isVailabel, 
   	  	              	  			   		 // hidden   : true,
   	  	              	  	                  dataIndex: 'PostCode'
   	  	              	  	              },{
   	  	              	  	                  header   : '通信地址', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	                  dataIndex: 'PostAddr'
   	  	              	  	              },{
   	  	              	  	                  header   : '展会名称', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  			   		  hidden   : true,
   	  	              	  	                  dataIndex: 'showName'
   	  	              	  	              },{
   	  	              	  	                  header   : '注册时间', 
   	  	              	  	                  width    : 75, 
   	  	              	  	                  sortable : true, 
   	  	              	  	         		  filter   : {
			   	  	            	              type : 'date'
			   	  	            	          },
   	  	              	  	                  renderer : Ext.util.Format.dateRenderer('Y-m-d H:i:s'), 
   	  	              	  			   		  //hidden   : true,
   	  	              	  	                  dataIndex: 'RegisterDate'
   	  	              	  	              }
   	  	              	  	          ]);

    	 // 	var proxy = new Ext.data.MemoryProxy(audienceArr);
    	 	var proxy = new Ext.data.HttpProxy({
        	 	url:'${pageContext.request.contextPath}/companyManagerAction!findCompany.action',
        	 	method:'post'
        	})
    	  	var record = Ext.data.Record.create([
    	  	                            {},
    	  	               				{name: 'id', type: 'int'},
	    	  	               			{name: 'CompName'},
	    	  	               			{name: 'EasyName'},
	    	  	               			{name: 'CompNameEn'},
	    	  	               			{name: 'EasyNameEn'},
	    	  	               			{name: 'CompAddr'},
	    	  	               			{name: 'CompAddrEn'},
	    	  	               			{name: 'Manager'},//经理
	    	  	               			{name: 'ManagerTel'},
	    	  	               			{name: 'Fman'},//法人代表
	    	  	               			{name: 'FmanTel'},
	    	  	               			{name: 'ChargeMen'},//负责人
	    	  	               			{name: 'ChargeMenTel'},
	    	  	               			{name: 'ChargeMenJob'},//负责人职位
	    	  	               			{name: 'CompTel'},
	    	  	               			{name: 'CompFax'},
	    	  	               			{name: 'CompPostCode'},
	    	  	               			{name: 'CompEmail'},
	    	  	               			{name: 'CompUrl'},
	    	  	               			{name: 'AssetType'},//企业资产类型
	    	  	               			{name: 'ManageType'},//企业经营类型
	    	  	               			{name: 'MustCredentials'},//参展必备条件（需要随表传真）
	    	  	               			{name: 'CompBrands'},//参展品牌
	    	  	               			{name: 'CompApprove'},//所获认证及荣誉
	    	  	               			{name: 'CompProduct'},//主要产品
	    	  	               			{name: 'Remark'},//备注
	    	  	               			{name: 'PostName'},
	    	  	               			{name: 'PostTel'},
	    	  	               			{name: 'PostCode'},
	    	  	               			{name: 'PostAddr'},
	    	  	               			{name: 'RegisterDate', type: 'date', dateFormat:'Y-m-d H:i:s'},
	    	  	               			{name: 'showName'}
    	  	          					//{name: 'audience_registerDate', type: 'date', dateFormat:'Y-m-d H:m:s'},
    	  	          					//{name: 'audience_isAvailable'}
    	  	            	  	          ]);
  	          var reader = new Ext.data.JsonReader({totalProperty:'totalcount',root:'companyList'},record);

  	  	      store = new Ext.data.Store({
  	  	          proxy:proxy,
  	  	          reader:reader
  	  	      });
  	  		  //分页添加参数
    	  	  store.on('beforeload', function() {    //Ext.data.JsonStore读入数据之前的事件,store不需要在写baseParams,因为会覆盖掉. (每次调用都载入此函数,'load'则第一次不调用外,其余都调用).
  	  	  	  this.baseParams = {
  	  	  			showInfoId:showId
  	  	  	  };
    	  	 	});
  	  	  	  store.load({
  	  	  			params : { start : 0, limit : 9 }
  	  	  	  });

  	  	      //显示性别
  	  	      function showSex(val){//0为男，1为女
  	  	  	      if(val == "0"){
  	  	  	  	      return '先生';
  	  	  	      }else if(val == "1"){
  	  	  	  	      return '女士';
  	  	  	      }
  	  	  	      return val;
  	  	      }
			  //用户是否可用
	  	  	  function isVailabel(val) {
	  	        if (val == 0) {
	  	            return '否';
	  	        } else if (val == 1) {
	  	            return '是';
	  	        }
	  	        return val;
	  	      }
	  	      
  	  	      grid = new Ext.grid.GridPanel({
  	  	          store: store,
  	  	     	  cm: cm,
  	  	          stripeRows: true,
  	  	          autoExpandColumn: 'id',
  	  	          height: 250,
  	  	          width: "100%",
  	  	      	  plugins: [filters],
  	  	      	  loadMask: true,
	  	  	     // sm: new Ext.grid.RowSelectionModel({singleSelect: true}),
	  	  	      sm: sm,
	  			  viewConfig: {
	  				  forceFit: true
	  			  },
  	  	          stateful: true,
  	  	          stateId: 'grid',
  	  	      	  columnLines: true,
  	  	          region:"north",
  	  	          //分页
	  	  	      bbar: new Ext.PagingToolbar({
	  	            pageSize: 9,
	  	            store: store,
	  	            displayInfo: true,
	  	            plugins: [filters],
	  	            displayMsg: '当前 {0} 到 {1}条 共 {2}条',
	  	            emptyMsg: "没有记录",
	  	            items:[
	  	                ]
	  	        })
  	  	      });
			//点击行数据显示问卷调查信息
      		var ct = new Ext.Panel({
      		//renderTo: 'binding-example',
      		frame: true,
      		//title: 'Book List',
      		width: 540,
      		height: 400,
      		layout: 'border',
      		region:'center',
      		items: [
      			grid,
      			{
      				id: 'detailPanel',
      				region: 'center',
      				autoScroll:true,
      				bodyStyle: {
      					//background: '#ffffff',
      					padding: '7px'
      				},
      				html: '<b>请选择一行数据查看详细信息。</b>'
          			}
          		]
          	});

          	grid.getSelectionModel().on('rowselect', function(sm, rowIdx, r){
	          	//提示等待
	      		var getQInfoMask = new Ext.LoadMask(Ext.getBody(),{msg:"正在获取信息，请稍候..."}); 
              	//alert(r.data.CompName);
          		//提示等待
          		getQInfoMask.show(); 
          		
              	var id = r.data.id;
              	selID = id;
              	var CompName = r.data.CompName;
              	var EasyName = r.data.EasyName;
              	var CompAddr = r.data.CompAddr;
              	var Manager = r.data.Manager;
              	var ManagerTel = r.data.ManagerTel;
              	var Fman = r.data.Fman;
              	var FmanTel = r.data.FmanTel;
              	var PostName = r.data.PostName;
              	var PostTel = r.data.PostTel;
              	var PostCode = r.data.PostCode;
              	var PostAddr = r.data.PostAddr;
              	var CompTel = r.data.CompTel;
              	var CompFax = r.data.CompFax;
              	var CompUrl = r.data.CompUrl;
              	var AssetType = r.data.AssetType;
              	var ManageType = r.data.ManageType;
              	var MustCredentials = r.data.MustCredentials;
              	var CompBrands = r.data.CompBrands;
              	var CompApprove = r.data.CompApprove;
              	var CompProduct = r.data.CompProduct;
              	var Remark = r.data.Remark;
                var showName = r.data.showName;
              	//转换日期格式（原格式是web apr 6 00：00：00 UTC+0800 2005）
              	var RegisterDate = Ext.util.Format.date(r.data.RegisterDate,'Y-m-d H:i:s');
              	
   			  	var bookTplStr = "";
   			  	bookTplStr = "<table border='1' width='100%' align='left' cellpadding='0' cellspacing='0' style='margin-top:0px;font-size:15px;'>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td width='110'><b>企业名称</b></td><td>"+CompName+"</td>"
		  		+"<td><b>简称</b></td><td>"+EasyName+"</td>"
		  		+"<td><b>企业地址</b></td><td colspan='3'>"+CompAddr+"</td>"
		  		+"</tr>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td><b>总经理</b></td><td>"+Manager+"</td>"
		  		+"<td><b>总经理手机</b></td><td>"+ManagerTel+"</td>"
		  		+"<td><b>法人代表</b></td><td>"+Fman+"</td>"
		  		+"<td><b>法人代表手机</b></td><td>"+FmanTel+"</td>"
		  		+"</tr>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td><b>负责人</b></td><td>"+PostName+"</td>"
		  		+"<td><b>负责人电话</b></td><td>"+PostTel+"</td>"
		  		+"<td><b>邮政编码</b></td><td>"+PostCode+"</td>"
		  		+"<td><b>通信地址</b></td><td>"+PostAddr+"</td>"
		  		+"</tr>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td><b>企业电话</b></td><td>"+CompTel+"</td>"
		  		+"<td><b>企业传真</b></td><td>"+CompFax+"</td>"
		  		+"<td><b>企业网址</b></td><td colspan='3'>"+CompUrl+"</td>"
		  		+"</tr>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td><b>企业资产类型</b></td><td>"+AssetType+"</td>"
		  		+"<td><b>企业经营类型</b></td><td>"+ManageType+"</td>"
		  		+"<td><b>参展条件</b></td><td>"+MustCredentials+"</td>"
		  		+"<td><b>参展品牌</b></td><td>"+CompBrands+"</td>"
		  		+"</tr>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td><b>企业荣誉</b></td><td>"+CompApprove+"</td>"
		  		+"<td><b>主要产品</b></td><td>"+CompProduct+"</td>"
		  		+"<td><b>备注</b></td><td colspan='3'>"+Remark+"</td>"
		  		+"</tr>"
		  		+"<tr style='background-color:#fff'>"
		  		+"<td><b>注册时间</b></td><td>"+RegisterDate+"</td>"
		  		+"<td><b>展会名称</b></td><td colspan='5'>"+showName+"</td>"
		  		+"</tr>"
   			  	+"</table>";
   			  	//alert(bookTplStr);

   			  	//var bookTplMarkup = ["用户名: {audience_name},<br/>手机: {audience_mobile},<br/>电子邮箱: {audience_email},<br/>Product Group: {ProductGroup}<br/>"];
           		var bookTplMarkup = [bookTplStr];
       	  	    var bookTpl = new Ext.Template(bookTplMarkup);
  	           	//alert(sm + "-----" + rowIdx + "\r\n" + Ext.util.JSON.encode(r.data));
           		var detailPanel = Ext.getCmp('detailPanel');
           		bookTpl.overwrite(detailPanel.body, "");
              		
           		//隐藏等待
           		getQInfoMask.hide();
          	});
            			   
          	grid.getSelectionModel().on('rowdeselect', function(sm, rowIdx, r){
              //	alert(1111);
              	var bookTplMarkup = ['<b>请选择一行数据查看详细信息。</b>'];
      	  	    var bookTpl = new Ext.Template(bookTplMarkup);
          		var detailPanel = Ext.getCmp('detailPanel');
          		bookTpl.overwrite(detailPanel.body, '');
          	});
          	//加载过滤按钮
          	grid.getBottomToolbar().add([
          		'->',{
                    text: '清除过滤',
                    handler: function () {
                        grid.filters.clearFilters();
                    } 
                },{
                    text: '重新加载',
                    handler: function () {
                        grid.reconfigure(store, cm);
                    } 
                },"-"
          		
          	]);
          	
          	var showInfoStore = new Ext.data.Store({
    			  proxy:new Ext.data.HttpProxy({url:'${pageContext.request.contextPath}/showInfoManagerAction!getAllShowInfo.action'}),
    			  reader:new Ext.data.JsonReader({root:'showInfoList'},['id','showName'])  //显示的字段名，与服务器端返回的json中字段一致
    			  });
    	  		showInfoStore.load();
            	
           	//展会form
           	var qTitleForm = new Ext.FormPanel({
      			frame:true,
      			labelAlign:"right",
      	        width:340,
      	        border:false,
      	        waitMsgTarget: true,
      	        region:"north",
      	        layout:"form",
      			items:[
      		    	   	
      		    	   	new Ext.form.ComboBox({
      		   			   id:'showInfoCombox',
      		   			   name:'showInfo',
      		               fieldLabel: '展会名称',
      		               hiddenName:'state',
      		               store: showInfoStore,
      		               valueField:'id',
      		               displayField:'showName',
      		               typeAhead: true,
      		               mode: 'local',
      		               triggerAction: 'all',
      		               emptyText:'请选择展会',
      		               selectOnFocus:false,
      		               width:240 
      		    	   	})
      			       ]
      			});
      		//根据展会查询调查问郑标题
      		Ext.getCmp("showInfoCombox").on('select',function(combo,record,index){
      			//当前选择的机构类的id
      			showId = Ext.getCmp('showInfoCombox').getValue();
      			var qTitleName = Ext.getCmp('showInfoCombox').getRawValue();
      			
      		  //根据选择的标题重新加载grid
  	  	  	  store.load({
  	  	  			params : {start : 0,limit : 9,showInfoId:showId}
  	  	  	  });
      		});
          	
		  var northPanel = new Ext.Panel({
			id:"northPanel",
			region:"north",
			//split:"true",
			layout:"fit",
			height:70,
			items:[
				qTitleForm
			],
			tbar:[//定义顶部工具栏
	 				 {
		         	      id:'deletenode',
		                   text: '删除',
		                   iconCls : 'remove',
		                   //pressed : true,
		                   handler : function(){
		                       var obArr = sm.getSelections();
		                   	   var selIDStr = "";
		                   	   if(obArr.length == 0){
			                   	   Ext.Msg.alert("提示","没有选中行");
			                   	   return;
		                   	   }
		                   	   for(var i=0;i<obArr.length;i++){
			                   	   if(selIDStr > 0){
			                   			selIDStr += ",";
			                   	   }
		                   			selIDStr += obArr[i].id;
		                   	   }
			                   deleteCompany(selIDStr,store);
			              }
			          },"-",
			          {
		         	       id:'exploreExcel',
		                   text: '导出Excel',
		                   iconCls : 'remove',
		                   handler : function(){
				        	   Ext.MessageBox.confirm("提示","确定生成Excel？",function(btn){
				      			 if(btn=="yes"){
			                	    window.location.href = "creatCompanyExcelAction.action?showId="+showId;
				      			 }
				        	   });
		                   }
	                  },"-",{
	                	  
	                	  id:'refresh',
		                  text: '刷新',
		                  iconCls : 'refresh',
		                  //pressed : true,
		                  handler : function(){
	                	  refresh(store);
	                  	  }
	                  }]
		  		});
  	  	      
  	  	  var centerPanel = new Ext.Panel({
	  	  		id:"centerPanel",
	  	  		layout:"border",
	  	  		region:"center",
	  	  		width:"75%",
	  	  		items:[
						//grid
						ct
	   	  	  		]
	  	  		
	  		});
  	  	var viewport = new Ext.Viewport({
			id : 'viewprot',
			layout : 'border',
			items : [
					northPanel,
					centerPanel
				]
		});
  	}
  		Ext.onReady(InitMain); 
  	
  	
  	</script>
  </body>
</html>
